﻿@using CoralNode.MvcClient.Helper
@using Coralcode.Base.Entity
@model CoralNode.Core.Entity.SearchQuerys.Node.NodeSearchQuery

@{
    ViewBag.Title = "ListNode";
    ViewBag.PageModule = "seo";
    ViewData["Module"] = "statistic";
}

@Html.IncludePage("CoralAdmin/Statistic", "_Left")
<!--content-->
<div id="pbody">
    <div class="extra">
        <div class="pbody_top">
            <span class="ico ico_setting_system"></span><span class="t t_c">菜单SEO管理</span>
        </div>
        <div id="main">
            <div class="content_tab extra_normal">
                <div class="tablist extra_normal">
                    <a href="/m/seo/ListNodeSeo">内容SEO</a>
                    <a class="current" href="/m/seo/ListMenuSeo">菜单SEO</a>
                    <a href="/m/seo/ListSiteSeo">站点SEO</a>
                </div>
            </div>
            <div class="">
                <div class="tablelist_style1" data-js="tabellist_style1">
                    <div class="funsearch p_1 pl_2 pr_2 extra_normal">
                        <div class="f_r">
                            <form method="" action="">
                                <span class="t_des f_l pt_0-5">菜单名称：</span>
                                <label class="search f_l">
                                    @Html.TextBoxFor(m => m.Title, new { @class = "text w_18", @msg = "请输入关键字" })
                                    @Html.AntiForgeryToken()
                                    <input type="submit" value="" class="submit" /></label>
                            </form>
                        </div>
                    </div>
                    <table cellpadding="0" cellspacing="0">
                        <tr class="exclude">
                            <th width="60">选择</th>
                            <th width="50" align="left">ID</th>
                            <th align="left">名称</th>
                            <th width="80">排序</th>
                            <th width="60">状态</th>
                            <th width="140">操作</th>
                        </tr>
                        @foreach (var item in @ViewBag.MenuList) {
                            <tr>
                                <td>
                                    <label class="checkbox_own">
                                        <input type="checkbox" value="@item.Id"/></label></td>
                                <td class="td_left">@item.Id</td>
                                <td class="td_left">
                                    @if (@item.ParentId > 0) {
                                        <span class="ico ico_child ml_@(item.Depth - 1)"></span><a href="/m/seo/editMenuSeo?menuId=@item.Id" class="js_dialog_seo">@item.Title</a>
                                    } else {
                                        <a href="/m/seo/editMenuSeo?menuId=@item.Id" class="js_dialog_seo">@item.Title</a>
                                    }
                                </td>
                                <td><a href="#" class="ico ico_moveup mr_2 f_no  btn"></a><a href="#" class="ico ico_movedown btn">
                                </a>
                                </td>
                                <td><a class="ico ico_eye_@item.IsValid  btn"></a></td>
                                <td>
                                    <div class="fun">
                                        <a class="js_dialog_seo" href="/m/seo/editMenuSeo?menuId=@item.Id">设置SEO</a>
                                    </div>
                                </td>
                            </tr>
                        }
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
        $(".js_dialog_seo").click(function (e) {
            e.preventDefault();
            var dialog = $.dialog({
                title: "设置SEO信息",
                content: '<img src="/Themes/CoralAdmin/_misc/images/loading.gif" style="display:block; margin:30px auto;" />',
                show: true,
                cancel: true,
                lock: true,
                ok: okfun,
                zIndex: 999
            });
            dialog.getJQuery().find(".d-state-highlight").css("margin-left", "140px");
            function okfun() {
                var $form = dialog.getJQuery().find("form");
                $.post($form.attr("action"), $form.serialize(), function (result) {
                    if (result.Type == 5) {
                        $.alert(result.Msg);
                        setTimeout(function () {
                            dialog.close();
                        }, 1000);
                    }
                });
            }
            var $this = $(this);
            dialog.visible();
            $.get($this.attr("href"), function (data) {
                dialog.content(data);
            });
        });
    })
</script>
